{% extends "base.html" %}
{% block title %}Yearly View {{ year }}{% endblock %}
{% block main_content %}
    <h3>
        <a href="{% url swingtime-yearly-view last_year %}" 
           title="Last Month">&larr;</a>
        Yearly View {{ year }}
        <a href="{% url swingtime-yearly-view next_year %}" 
           title="Next Month">&rarr;</a>
    </h3>
    
    {% if by_month %}
    <table>
        <thead>
            <tr>
                <th>Month</th>
                <th>Title</th>
                <th>Day</th>
                <th>Start</th>
                <th>End</th>
            </tr>
        </thead>
        <tbody>
        {% for dt,occurrences in by_month %}
        <tr class="month-divider">
            <th rowspan="{{ occurrences|length }}">
                <a href="{% url swingtime-monthly-view dt.year dt.month %}">
                    {{ dt|date:"F" }}</a>
            </th>
            {% for o in occurrences %}
            <td><a href="{{ o.get_absolute_url }}">{{ o.title }}</a></td>
            <td>{{ o.start_time|date:"M jS - l" }}</td>
            <td>{{ o.start_time|date:"P" }}</td>
            <td>{{ o.end_time|date:"P" }}</td>
        </tr>
            {% if not forloop.last %}
        <tr>
            {% endif %}
            {% endfor %}
        {% endfor %}
        </tbody>
    </table>
    {% else %}
    <p>No events occurring in {{ year }}</p>
    {% endif %}
{% endblock %}